from mongoengine import Document, StringField, IntField, FloatField


class Sensor(Document):
    device_name = StringField(null=True, validation=False)
    grain = IntField(null=True, validation=False)
    boot_time = StringField(null=True, validation=False)
    created_at = StringField(null=True, validation=False)

    cpu_temperature = StringField(null=True, validation=False)
    cpu_percent_1 = FloatField(null=True, validation=False)
    cpu_percent_2 = FloatField(null=True, validation=False)
    cpu_percent_3 = FloatField(null=True, validation=False)
    cpu_percent_4 = FloatField(null=True, validation=False)
    cpu_percent = FloatField(null=True, validation=False)
    cpu_frequency = FloatField(null=True, validation=False)

    disk_percent = FloatField(null=True, validation=False)
    disk_total = StringField(null=True, validation=False)
    disk_used = StringField(null=True, validation=False)

    memory_percent = FloatField(null=True, validation=False)
    memory_available = StringField(null=True, validation=False)
    memory_buffers = StringField(null=True, validation=False)
    memory_cached = StringField(null=True, validation=False)
    memory_total = StringField(null=True, validation=False)
    memory_used = StringField(null=True, validation=False)

    swap_percent = FloatField(null=True, validation=False)
    swap_total = StringField(null=True, validation=False)
    swap_used = StringField(null=True, validation=False)

    network_receive = StringField(null=True, validation=False)
    network_sent = StringField(null=True, validation=False)

    humidity = FloatField(null=True, validation=False)
    temperature = FloatField(null=True, validation=False)

    meta = {'indexes': ['device_name', 'grain']}
